#ifndef GLPICWIDGET_H
#define GLPICWIDGET_H

#include <QGLWidget>
#include "ui_glpicwidget.h"
#include "Commonality.h"



class GLPicWidget : public QGLWidget
{
	Q_OBJECT

public:
	GLPicWidget(QWidget *parent = 0);
	~GLPicWidget();

protected:
	void initializeGL();         
	void resizeGL(int w, int h);          
	void paintGL();  
	/// What to do if a button of the mouse is pressed
	void mousePressEvent(QMouseEvent *event);
	/// What to do if the mouse is moved while a button is being pressed
	void mouseMoveEvent(QMouseEvent *event);

	void wheelEvent(QWheelEvent* event);

	void  keyPressEvent ( QKeyEvent * event );
	void  keyReleaseEvent ( QKeyEvent * event ); 
	void contextMenuEvent(QContextMenuEvent *event);

	

private:
	Ui::GLPicWidget ui;

public:
	void draw();
	void Init();


	QAction* qActionSelectAviModel;
	QAction* qActionSelectAvi;
	QAction* qActionLoadAviTexture;
	QVector<QString> m_qVectorListFile;
	void GetFolderFile(const QString & path,QVector<QString>& vectorList);

	QMap<QString,CvCapture*> m_qMapCvCaptureList;

	QVector<CvStructData*> m_qVectorStructDataList;

	void LoadCvTexture();
	void LoadTexture( GLuint& textureID);

	void LoadTexture( GLuint& textureID ,int w,int h );

	void LoadTexture(const char* filename,GLuint& textureID );
	void DrawAviTexture();

	void GetCoordinate(float x,float y,float z,float& resultx,float& resulty,float& resultz,int intMode);

	GLuint backGroundID;
	bool bSelectModel;

	void DrawAviTexture(GLenum mode);
public slots:
	void LoadAviTexture();
	void LoadSelectAviTexture();
	void SelectAviTextureModel();
};

#endif // GLPICWIDGET_H
